package cn.hh.hrm.feign;


import cn.hh.hrm.domain.LoginUser;
import cn.hh.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class LoginUserFallBackFactory implements FallbackFactory<ILoginUserFeignClient> {
    @Override
    public ILoginUserFeignClient create(Throwable throwable) {
        return new ILoginUserFeignClient() {
            @Override
            public AjaxResult addOrUpdate(LoginUser loginUser) {
                return AjaxResult.me().setSuccess(false).setMessage("授权服务调用异常，请稍后重试");
            }
        };
    }
}
